// pages/my/my.js
// 请求方法
const HTTP = require("../../utils/http-list.js");
const http = new HTTP();
//getApp()的数据
let app=getApp();
let gd = app.globalData;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    my:"",
    isread:0,
    phone:"",
    img:""
  },
  /**
   * 
   * @param {跳转信息} options 
   */
  goMessage(){
    wx.navigateTo({
      url:"/pages/message/message"
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },
  goyouhui(){
    wx.navigateTo({
      url:"/pages/daijin/daijin?id=2"
    })
  },
  goquanyi(){
    let url=encodeURIComponent('https://callme.lixinapp.com/weixiu/a/agreement/agreement/disPlayDetail?id=32969b5b6e4c495abdb533ac1ee2e0a3')
    wx.navigateTo({
      url:"/pages/web/web?url="+url
    })
  },
  goone(){
    wx.navigateTo({
      url:"/pages/gemessage/gemessage"
    })
  },
  govip(){
    wx.navigateTo({
      url:"/pages/vippay/vippay"
    })
  },
  godengji(){
    wx.navigateTo({
      url:"/pages/vipqy/vipqy?name="+this.data.my.score+"&lv="+this.data.my.levelName
    })
  },
  gokefu(){
    wx.navigateTo({
      url:"/pages/asklist/asklist?phone="+gd.kfphone
    })
  },
  goaboutus(){
    let url=encodeURIComponent("https://callme.lixinapp.com/weixiu/a/agreement/agreement/disPlayDetail?id=74d8920bb138440a8a1455f89a0b4ed1")
    wx.navigateTo({
      url:"/pages/web/web?url="+url
    })
  },
  goset(){
    wx.navigateTo({
      url:"/pages/set/set"
    })
  },
  goshouhuo(){
    wx.navigateTo({
      url:"/pages/addressset/addressset"
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    // if(gd.myMessage!=""){
    //   return;
    // }
    http.showLoading("请求数据").postD({
      cmd:"getUserInfo",
      uid:gd.userId ,
    }).then((res)=>{
      if(res.data.result==0){
        gd.myMessage=res.data;
        this.setData({
          my:res.data,
          isread:res.data.isRead-0
        })
        
      }
      this.setData({
        phone:gd.kfphone
      })
      return http.postD({
        cmd:"getImage"
      })
    }).then((res1)=>{
      if(res1.data.result==0){
        this.setData({
          img:"'"+res1.data.image+"'"
        })
        wx.hideLoading();
      }
    })
  },
  addPhone() {
    wx.addPhoneContact({
      firstName: "装修客服",
      mobilePhoneNumber: this.data.phone
    })
  },
 
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },
  
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})